<template>
    <div>
        <div>
            <el-header style="font-size: 20px;position: relative;left: -20px;top: 20px">
                <i class="el-icon-user"></i>审批记录
            </el-header>

            <el-table
                    :data="FlowAudits"
                    border
                    style="width: 100%">
                <el-table-column
                        prop="aid"
                        label="序号">
                </el-table-column>
                <el-table-column
                        fixed
                        prop="createdate"
                        label="审批时间">
                </el-table-column>
                <el-table-column
                        prop="userRealname"
                        label="办理人">
                </el-table-column>
                <el-table-column
                        prop="info"
                        label="审批状态">
                    <template slot-scope="scope">
                        {{scope.row.info == 'Y' ? '同意':'不同意'}}
                    </template>
                </el-table-column>
                <el-table-column
                        prop="remark"
                        label="备注">
                </el-table-column>
            </el-table>
        </div>
        <el-divider></el-divider>

        <div>
            <el-header style="font-size: 20px;position: relative;left: -20px;top: 20px">
                <i class="el-icon-user"></i>我的审批
            </el-header>
            <el-form ref="form" :model="Approval" label-width="80px">
                <el-form-item label="审批操作">
                        <el-radio-group v-model="Approval.info">
                            <el-radio label="Y">通过</el-radio>
                            <el-radio label="N">不通过</el-radio>
                        </el-radio-group>
                </el-form-item>
                <el-form-item label="描述">
                    <el-input type="textarea" v-model="Approval.remark"></el-input>
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" @click="onSubmit">确认提交</el-button>
                    <el-button @click="back">取消</el-button>
                </el-form-item>
            </el-form>
        </div>
    </div>
</template>

<script>

    import  FlowAuditService from '../../../model/common/flow/FlowAuditService.js'
    const flowAuditService=FlowAuditService.getInstance();

    export default {
        name: "Handle",
        props:['row'],
        data(){
            return{
                rows:this.row,
                target:this.row.target,
                FlowAudits:[],
                Approval:{},
            }
        },
        watch:{
            row:function () {
                this.rows=this.row
            },
        },
        created(){
            this.selectByFid();
        },
        methods:{
            selectByFid(){
                flowAuditService.selectByFid(this.rows.fid).then(response=>{
                    this.FlowAudits = response.data.data
                })
            },
            onSubmit(){
                this.Approval.fid=this.rows.fid
                this.Approval.flowNodeId=this.rows.current
                console.log(this.Approval)
                flowAuditService.save(this.Approval).then(()=>{
                    this.$emit("completed")
                })
            },
            back(){
                this.$emit('back')
            }
        },
        components:{
        }
    }
</script>

<style scoped>

</style>
